package com.liuchuanzheng.lcz_wanandroid

import android.app.Application
import android.content.Context
import android.hardware.Camera
import com.kingja.loadsir.core.LoadSir
import com.liuchuanzheng.lcz_wanandroid.module.common.callback.CustomCallback
import com.liuchuanzheng.lcz_wanandroid.module.common.callback.EmptyCallback
import com.liuchuanzheng.lcz_wanandroid.module.common.callback.ErrorCallback
import com.liuchuanzheng.lcz_wanandroid.module.common.callback.LoadingCallback
import com.liuchuanzheng.lcz_wanandroid.util.log.LogUtil
import kotlin.properties.Delegates

/**
 * @author 刘传政
 * @date 2021/9/13 0013 17:20
 * QQ:1052374416
 * 电话:18501231486
 * 作用:
 * 注意事项:
 */
class App :Application() {
    companion object {
        //这写法可以获取时没初始化就报错。实际使用其实意义不大。
        var instance: Application by Delegates.notNull()
            private set

    }
    override fun onCreate() {
        super.onCreate()
        instance = this
        LogUtil.init()
        initLoadSir()
    }
    fun initLoadSir(){
        LoadSir.beginBuilder()
            .addCallback(ErrorCallback())
            .addCallback(EmptyCallback())
            .addCallback(LoadingCallback())
            .addCallback(CustomCallback()) //暂时用不到
            .setDefaultCallback(LoadingCallback::class.java)
            .commit()
    }
}